#pragma once
#include "Unit.h"
#include "atltypes.h"
/** */
struct OneRowText
{
	OneRowText(){}
	OneRowText(CPoint& p,CString& s):textPt(p),text(s){}
	CPoint textPt;
	CString text;
};

///Text
/** */
class CTextUnit : public CUnit
{
public:
	CTextUnit(void);
	~CTextUnit(void);
	void Draw(CDC* pDC);
	void Preview(CDC* pDC);
	BOOL OnHitTest(CPoint* point);
	BOOL AllowText();
	void Save(CArchive&);
	void Load(CArchive&);
	void Track(CWnd* parent,CPoint* point);
	BOOL ContainUnit(CUnit* unit);
	CPoint* GetVertex(int &count);
	void AttachTracker();
	void AddLink(LinkArrow link);
	void RemoveLink(LinkArrow link);
	/** */
	CPoint m_caretPos;
	/** */
	CPoint m_caretPt;
	/** */
	BOOL m_BorderOn;
	/** */
	std::vector <OneRowText> m_text;
	/** */
	void ShowText(CDC* pDC, bool isBkColor);
	/** */
	void CalTextPos(CDC* pDC);
	void ShowBorder(BOOL border);

	void TrackBroad(CPoint old_begin,CPoint old_end);
	void DistachTracker();
};
